package com.yanqu.road.server.manger.activity.curio.condition;

import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.curio.CurioModule;

import java.util.List;

/**
 * 藏品系统-新统计值条件
 */
public class CurioCountCondition extends BaseCurioSpecialCondition {

    int type;

    public CurioCountCondition(int type, GamePlayer player) {
        super(player);
        this.type = type;
    }

    @Override
    public boolean isCompleted(List<Integer> params) {
        int needNum = params.get(0);
        return getConditionValue(params) >= needNum;
    }

    @Override
    public long getConditionValue(List<Integer> params) {
        if(params.size() > 1){
            return player.getModule(CurioModule.class).getUserCurioCount(this.type, params.get(1));
        }else {
            return player.getModule(CurioModule.class).getUserCurioCount(this.type);
        }
    }
}
